﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.Coolzon.UI
{
    /// <summary>
    /// 扩展属性定义,扩展属性必须支持公共可访问的读写操作
    /// </summary>
    [AttributeUsage(AttributeTargets.Property)]
    public class XPropertyAttribute : Attribute
    {
        /// <summary>
        /// 扩展属性名称
        /// </summary>
        public string Name { get; private set; }
        /// <summary>
        /// 扩展属性描述
        /// </summary>
        public string Caption { get; private set; }
        /// <summary>
        /// 扩展属性类型
        /// </summary>
        public XPropertyCategory Category { get; private set; }

        /// <summary>
        /// 是否支持脚本修改
        /// </summary>
        public bool IsScriptSupport { get; private set; }

        /// <summary>
        /// 是否已弃用
        /// </summary>
        public bool IsDeprecated { get; private set; }

        public XPropertyAttribute(XPropertyCategory category, string name, string caption)
        {
            Category = category;
            Name = name;
            Caption = caption;
            IsDeprecated = false;
        }

        public XPropertyAttribute(XPropertyCategory category, string name, string caption, bool isScriptSupport)
        {
            Category = category;
            Name = name;
            Caption = caption;
            IsScriptSupport = isScriptSupport;
            IsDeprecated = false;
        }

        public XPropertyAttribute(XPropertyCategory category,
            string name, 
            string caption,
            bool isScriptSupport,
            bool isDeprecated)
        {
            Category = category;
            Name = name;
            Caption = caption;
            IsScriptSupport = isScriptSupport;
            IsDeprecated = isDeprecated;
        }
    }
}
